 # assumes normalized nums
 function dist(r1,r2,   dist) {
     for(col in Num)
	 if (col != K)
	     dist += distNum(Data[r1,col],Data[r2,col])^2
     for(col in Sym)
	 if (col != K)
	     dist += distSym(Data[r1,col],Data[r2,col])
     return sqrt(dist)/sqrt(A)
 }
 # if missing values, return max distance (need to handle missing values)
 function distNum(x,y) {
     if (x == Missing && y == Missing) return 1
     if (x == Missing) return y > 0.5 ?  1 - y : y
     if (y == Missing) return x > 0.5 ?  1 - x : x
     return x - y
 }
 function distSym(x,y) {
     if (x == Missing || y == Missing)
	 return 1
     return y == x ? 0 : 1
 }